package com.ykc.bean;

import java.util.Objects;

/**
 * @author Ykc
 * @date 2021年05月25日 15:09
 * @description
 */
public class Request {

    //请求方法
    private String requestMethod;
    //请求路径
    private String requestPath;

    public Request(String requestMethod, String requestPath) {
        this.requestMethod=requestMethod;
        this.requestPath=requestPath;
    }

    public String getRequestMethod() {
        return requestMethod;
    }

    public String getRequestPath() {
        return requestPath;
    }


    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (!(obj instanceof Request)) return false;
        Request request = (Request) obj;
        return request.getRequestMethod().equals(this.requestMethod)&&request.getRequestPath().equals(this.requestPath);
    }

    //重写equals就必须重写hashCode这是一种规范
    @Override
    public int hashCode() {
        int result=21;
        result=24*result+requestMethod.hashCode();
        result=24*result+requestPath.hashCode();
        return result;
    }
}
